#include <stdint.h>
#include <hash.h>
#include "threads/synch.h"

//User frame table
struct frame
{
    void *page; //the page currently store the frame
    uint8_t *frame_entry;
    int type; // -1为该frame可用，0为该frame已被占用
    bool pin; // 是否被写过？
    bool u; // 是否被访问过？
    struct lock frame_lock;
};

void init_frame (void);
int frame_get_no (uint32_t frame_vaddr);
void *frame_allocator (uint8_t *, bool);
bool frame_reload_page (uint8_t *page);
bool frame_user_stack_grow (void *addr);
void frame_evict_page (uint8_t *page, bool swap);